package com.example.redis6.dao;

import com.example.redis6.model.VideoDo;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * description: VideoDao <br>
 * date: 2021/7/21 09:39 <br>
 *
 * @author: ZhangYixin <br>
 * version: 1.0 <br>
 */
@Repository
public class VideoDao {

    private static Map<Integer,VideoDo> map = new HashMap<>();

    static {
        map.put(1,new VideoDo(1,"class1","https://xdclass.net",1099));
        map.put(2,new VideoDo(2,"class2","https://xdclass.net",79));
        map.put(3,new VideoDo(3,"class3","https://xdclass.net",49));
        map.put(4,new VideoDo(4,"class4","https://xdclass.net",49));
        map.put(5,new VideoDo(5,"class5","https://xdclass.net",49));
        map.put(6,new VideoDo(6,"class6","https://xdclass.net",59));
    }

    /**
     * 模拟从数据库找
     * @param videoId
     * @return
     */
    public VideoDo findDetailById(int videoId) {
        return map.get(videoId);
    }

}
